const http = require('http')
const url = require('url')
const { Router } = require('./router/router')

http.createServer((req, res) => {
  const { pathname, query } = url.parse(req.url, true)
  res.setHeader('Access-Control-Allow-Origin', '*')
  Router(pathname, req, res)
}).listen(4000, () => {
  console.log('服务器启动了，监听端口4000')
})
